package com.hspedu.newData.dmsxl.数组;

import org.junit.Test;

/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-04-30 
 * @Version: 1.0
 */

public class LC2595奇偶位数 {

    public int[] evenOddBit(int n) {

        int count = 0;
        int even = 0;
        int odd = 0;
        while(n > 0){
            if ((n&1)==0){
                if (count % 2 == 0){
                    odd++;
                }else {
                    even++;
                }

            }
            count++;
            n = n>>1;
        }

        return new int[]{even,odd};
    }

    @Test
    public void test() {
        // 测试代码

        int[] ints = evenOddBit(2);
        System.out.println("----");
    }
}
